package com.mcy.springbatch.listener;

import com.mcy.springbatch.entity.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.ItemWriteListener;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author : Create By mcy
 * @date : 2019/8/26 08:45:12
 */
@Slf4j
@Component
public class WriteDataItemWriteListener implements ItemWriteListener<SysUser> {

    @Override
    public void beforeWrite(List<? extends SysUser> items) {
        log.info("写数据前:{}",items);
    }

    @Override
    public void afterWrite(List<? extends SysUser> items) {
        log.info("写数据后:{}",items);
    }

    @Override
    public void onWriteError(Exception exception, List<? extends SysUser> items) {
        log.error("写数据出错:{}",items,exception);
    }
}
